package com.atguigu.eduservice.controller;


import com.atguigu.commonutils.R;
import com.atguigu.eduservice.service.EduSubjectService;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author lhl
 * @since 2022-07-01
 */
@RestController
@RequestMapping("/eduservice/edu-subject")
@CrossOrigin
public class EduSubjectController {
    @Resource
    private EduSubjectService eduSubjectService;
//    添加分类代码
    @PostMapping("addSubject")
    public R addSubject(MultipartFile file){
        eduSubjectService.addSubject(eduSubjectService,file);
        return R.ok();
    }
    // 获取所有课程分类信息
    @GetMapping("/getSubjectInfos")
    public R getInfos(){
        return R.ok().data("infos",eduSubjectService.getInfos());
    }
}

